package service;

import java.util.List;

import bean.Goods;
import bean.GoodsRowMapper;
import bean.User;
import bean.UserRowMapper;
import common.BaseDAO;

public class adminMemberDAO extends BaseDAO{
	//获取所有会员记录
		public int listAll(){
			String sql="select count(*) from user_info where ifexist=1 order by userid";
			return this.getCount(sql);
		}
		public List<User> queryAllMembers(int pagesize,int viewPage){
			int offset=pagesize*(viewPage-1);
				String sql = "select * from user_info where ifexist=1 order by userid limit ?,?";
				return this.query(sql, new UserRowMapper(),offset,pagesize);
		}
		//根据会员ID修改(伪)删除商品
		public void delete(String userid) {
				String sql="update user_info set ifexist=0 where userid=?";
				this.update(sql,userid);	
		}
		public List<User> queryMembers(int userid){
				String sql = "select * from user_info where userid=?";
				return this.query(sql, new UserRowMapper(),userid);
		}
		//更新会员信息
		public void updateUser(int userid,int sex, int points,int exp,int ifexist,String nickname) {
				String sql="update user_info set sex=?,points=?,exp=?,ifexist=?,nickname=? where userid=?";
				this.update(sql,sex,points,exp,ifexist,nickname,userid);	
		}

}
